package com.ruoyi.user.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.user.domain.CarBrand;
import com.ruoyi.user.service.CarBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/carBrand")
@CrossOrigin
public class CarBrandController extends BaseController {
    
    @Autowired
    private CarBrandService carBrandService;
    
    /**
     * 查询品牌列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CarBrand carBrand) {
        startPage();
        List<CarBrand> list = carBrandService.selectCarBrandList(carBrand);
        return getDataTable(list);
    }
    
    /**
     * 获取所有品牌列表（不分页）
     */
    @GetMapping("/listAll")
    public AjaxResult listAll(CarBrand carBrand) {
        List<CarBrand> list = carBrandService.selectCarBrandList(carBrand);
        return AjaxResult.success(list);
    }
}